package Lee_code;

/**
 * @author blh
 * @date 2024年11月04日 9:11
 * 平方数之和
 */
public class Lee_633_114 {
    public boolean judgeSquareSum(int c) {
        for (int i = 1; i < (int) Math.sqrt(c); i++) {
            int other = c - i * i;
            if (Math.sqrt(other) % 1 > 0) {
                continue;
            } else {
                return true;
            }
        }
        return false;
    }

    public boolean judgeSquareSum2(int c) {
        for (long a = 0; a * a <= c; a++) {
            double b = Math.sqrt(c - a * a);
            if (b == (int) b) {
                return true;
            }
        }
        return false;
    }


}
